<%--
    Document   : UserSetting
    Created on : 2011-9-30, 14:37:43
    Author     : Cong
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
<!DOCTYPE html>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>New Threads</title>
        <script type="text/javascript" src="resource/paintweb/build/paintweb.js"></script>
        <link rel="stylesheet" type="text/css" href="resource/main_page/main-page.css" />
        <script type="text/javascript" src="resource/tiny_mce/tiny_mce.js"></script>
        <script type="text/javascript" src="resource/jquery-1.6.2.min.js"></script>
        <script type="text/javascript" language="JavaScript" src="resource/main_page/main_page.js"></script>
        <script type="text/javascript" language="JavaScript" src="resource/view_threads/thread.js"></script>
        <script type="text/javascript" >
            tinyMCE.init({
                // Location of TinyMCE script
                mode : "textareas",

                // General options
                theme : "advanced",
                plugins : "emotions,mcegooglemaps,youtube,contextmenu,paintweb,fmath_formula",
                cleanup : false,
                relative_urls : false,
                plugin_googleMaps_apiKey:"QIAAAAh3Y2QoSqdcXL9jo1hf2_qxQ9sdfsdUz7H1ndauxi_u81aUINhLhQcghghghJCUhECPRpMPaaU9UCCQ",
                plugin_googleMaps_coordinates:"-33.8884934,151.1870998",
                paintweb_config : {
                    configFile: "config-example.json",
                    tinymce: {
                        // Tell where PaintWeb is located.
                        paintwebFolder: "/resource/paintweb/build/",
                        imageSaveDataURL: true,
                        overlayButton: true,
                        contextMenuItem: true,
                        dblclickHandler: true,
                        pluginBar: true,
                        syncViewportSize: true
                    }
                },
                // Theme options
                theme_advanced_buttons3_add :"emotions,mcegooglemaps,youtube,paintwebEdit,fmath_formula",
                theme_advanced_toolbar_location : "top",
                theme_advanced_toolbar_align : "left",
                theme_advanced_statusbar_location : "bottom",
                theme_advanced_resizing : true
            });
               
            function test(){
                var check = true;
                var title=document.getElementById("title").value;
                if(title=="")
                {
                     alert("the title cannot be null");
                     check = false;
                }
                var content = tinyMCE.getInstanceById("content").getBody().innerHTML;
	        if(content.length<10||content=="<p><br data-mce-bogus=\"1\"></p>")
                {
                     alert("insufficient words of content");
                     check = false;
                }
                return check;
            }

            var counter = 15;

            function show()
            {
                jQuery("#submit").attr("value",counter);
                counter = counter - 1;
                if(counter > 0)
                    setTimeout("show()",1000);
                else
                    changeButton();
            }

            function changeButton()
            { 
                jQuery("#submit").removeAttr("disabled");
                jQuery("#submit").attr("value","Submit");
            }

            
        </script>
        
    </head>

    <body onkeydown="try{keyCodes(event);}catch(e){}" onload="show()">
        <div class="main-wrap">
            <div id="user-nav">
                <%@ include file="ForumHead.jsp" %> 
            </div>
            <div id="main">
                <style type="text/css">
                    .t table tr.tr2 td.f{width:22%;}
                    .t table tr.tr2 td.e{width:10em;}
                </style>
                <div class="forum-info cc gray">
                    <div class="fr">welcome,${session.user.unikey}|<a href="LoginAction_out"><b>Logout</b></a></div>
                </div>
                <style type="text/css">
                    .tr3 td,.tr3 th{padding:4px 8px;line-height:1.3;}
                    .tr_rep{padding:0;color:#999;}
                    .tr_rep span{color:#ff6600;}
                    .threadlist{padding-left:10px;bottom:-1px;position:absolute;}
                    .threadlist a{display:block;float:left;padding:0 9px;border-bottom:0;line-height:25px;height:25px;}
                    .threadlist .bta{height:20px;line-height:20px;border:1px solid #a6cbe7;margin-left:1em;}
                    .threadlist .current,.threadlist .active{background:#ffffff;border:1px solid #c5d8e8;padding:0 8px;border-bottom:0;color:#3d75ac;}
                    .t-cate-s{border-top:1px solid #d5e6ed;margin-top:10px;}
                    .t-cate-s .threadlist2{padding:5px 10px;line-height:25px;}
                    .t-cate-s .threadlist2 a{color:#3366cc;float:left;white-space:nowrap;padding:0 10px;}
                    .t-cate-s .threadlist2 .current{ font-weight:700;}
                    .t-cate-s .p10 span{float:left;margin:0 20px 10px 0; height:25px; white-space:nowrap;}
                    .t-cate-s .p10 input{ vertical-align:middle;}
                    .t-cate-s .p10 .btn{margin:0 5px;}
                    .t_search{border:1px solid #a6cbe7;background:#ffffff;margin-left:5px;height:18px;overflow:hidden;}
                    .t_s_ip{border:1px solid #fff;padding:1px 2px 0;float:left;height:15px; font:12px/14px Arial;background:#fff; width:85px;}
                    .t_s_btn{float:left;background:#f3f9fb url(resource/view_threads/t_search.png) center -1px no-repeat;border:1px solid #fff;border-left:1px solid #d5e6ed; cursor:pointer;width:25px;height:18px;overflow:hidden;}
                    .t_search input::-moz-focus-inner{border-color:transparent!important;}
                </style>
                <div id="breadCrumb" class="cc">
                    <s:url id="url_view" value="ThreadAction_listThreads">
                        <s:param name="categoryID" value="#session.categoryID"/>
                        <s:param name="categoryName" value="#session.categoryName"/></s:url>
                    <img style="cursor:pointer" id="td_cate" src="resource/view_threads/home.gif" align="absmiddle" /> <a href="main.jsp" title="ELEC_Forum">ELEC Forum</a> &raquo; <s:a href="%{url_view}">${session.categoryName}</s:a>
                </div>
                <div class="c"></div>
                <div class="c" id="c"></div>
                <!-- 这里供你自由发挥 -->
                <style type="text/css">
                        #contentField {padding-left: 150px;}
                        #titleField {margin-bottom: 20px;}
                        #title {width: 300px; height: 20px;}
                        #submit {margin-top: 20px; width: 70px; height: 30px;}
                </style>

                <div id="contentField">
                    <form action="ThreadAction_newThread" method="post" onsubmit="return test()">
                        <div id="titleField">
                            Title: &nbsp;<input type="text" id="title" name="title"/>
                        </div>
                        <textarea id="content" name="content" rows="30" cols="80" style="width: 80%"></textarea>
                        <input type="submit" id="submit" value="15" disabled="disabled"/>
                    </form>
                </div>
            </div>
        </div>
    </body>
</html>
<script language="JavaScript" src="resource/main_page/fast_access.js"></script>
<%@ include file="ForumFoot.jsp" %>
